﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.Composition;

using NuMetaheuristics;

namespace NuMetaheuristics.Operators.Value
{
    /// <summary>
    /// Multiply two values.
    /// </summary>
    [Export(typeof(IBinaryOperator<double>))]
    [DataContract(Namespace = "http://numetaheuristics.codeplex.com/schemas")]
    public class DoubleMultiplier : IBinaryOperator<double>
    {
        public double Operate(double operandL, double operandR)
        {
            return operandL * operandR;
        }
    }

    /// <summary>
    /// Multiply two values.
    /// </summary>
    [Export(typeof(IBinaryOperator<int>))]
    [DataContract(Namespace = "http://numetaheuristics.codeplex.com/schemas")]
    public class IntegerMultiplier : IBinaryOperator<int>
    {
        public int Operate(int operandL, int operandR)
        {
            return operandL * operandR;
        }
    }

    /// <summary>
    /// Divide two values.
    /// </summary>
    [Export(typeof(IBinaryOperator<double>))]
    [DataContract(Namespace = "http://numetaheuristics.codeplex.com/schemas")]
    public class DoubleDivider : IBinaryOperator<double>
    {
        public double Operate(double operandL, double operandR)
        {
            return operandL / operandR;
        }
    }

    /// <summary>
    /// Divide two values.
    /// </summary>
    [Export(typeof(IBinaryOperator<int>))]
    [DataContract(Namespace = "http://numetaheuristics.codeplex.com/schemas")]
    public class IntegerDivider : IBinaryOperator<int>
    {
        public int Operate(int operandL, int operandR)
        {
            return operandL / operandR;
        }
    }
}
